package com.xiancheng;

public class MyThreadDemo {
    public static void main(String[] args) throws InterruptedException {
        MyThread thread1 = new MyThread();
        MyThread thread2 = new MyThread();

        thread1.setName("高铁");
        thread2.setName("飞机");

        // 设置主线程
        Thread.currentThread().setName("地铁");
        // 设置守护线程
        thread1.setDaemon(true);
        thread2.setDaemon(true);


//        System.out.println(thread1.getPriority());
//        System.out.println(thread2.getPriority());
        // 更改线程2的优先级
//        thread2.setPriority(7);

        thread1.start();
        thread2.start();

        for (int i = 0; i < 50; i++) {
            System.out.println(Thread.currentThread().getName() + ":" + i);
        }

//        thread1.join();
//        thread2.join();
        // 返回对当前正在执行的线程对象的引用
        System.out.println(Thread.currentThread().getName());

    }
}
